#ifndef PAINTWIDGET_H
#define PAINTWIDGET_H

#include <QWidget>
#include <QImage>
#include <QPoint>

#include "core/DrawPath.h"

class PaintWidget : public QWidget
{
    Q_OBJECT
public:
    PaintWidget(QWidget *parent = 0);

    void drawPaths(const QList<DrawPath *> * paths, QColor color);

    void imagePaint(const QImage & image);

    void setPaintColor(QColor color) { paintColor = color; }

    void setLocked(bool value);
signals:
    void pointDrawed(QPoint);

protected:
    void resizeEvent (QResizeEvent * event);
    void paintEvent(QPaintEvent *event);

    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);

private:
    volatile bool locked;
    QColor paintColor;
    QImage inputImage;
    QPoint lastPosition;
};

#endif // PAINTWIDGET_H
